﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Web;
namespace MyTest 
{
    /// <summary>
    /// Book2 的摘要说明
    /// </summary>
    public class Book2 : Product

    {
        private string isbn;//书号
        private string intro;//简介

        public string Isbn
        {
            get { return isbn; }
            set {
                if (value.Length != 13)
                {
                    throw new ArgumentException("请输入13位的ISBN号" + "<br>");
                }
                isbn = value; }
        }   

        public string Intro
        {
            get { return intro; }
            set { intro = value; }
        }

        public Book2():base("默认书籍名称")
        {
            Debug.WriteLine("-=调用Book2的无参构造方法=-");

        }

        public override string ShowDetail()
        {
            return "ISBN: " + this.isbn + ",简介: "+ this.intro;
        }

        //virtual默认可以被子类覆盖的
        public override string Show()
        {
            return "书籍名称: " + this.name + "书籍价格: " + this.price;
        }

        ~Book2()
        {
            Debug.WriteLine("-=调用Book2的析构方法=-");
        }
    }
}
